<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Alessandro Service</title>
    </h:head>
    <h:body>
        <h:form>
            <h:panelGrid columns="2" border="1">
                <h:outputLabel value="Nome Pessoa" for="nomePessoa"/>
                <h:inputText value="#{pessoaBean.pessoa.nome}" id="nomePessoa"/>

                <h:outputLabel value="Data Nascimento :"/>
                <p:calendar value="#{pessoaBean.pessoa.dtNascimento}" />

                <h:outputLabel value="Sexo :" for="sexoPessoa"/>
                <h:selectOneMenu value="#{pessoaBean.pessoa.sexo}" id="sexoPessoa" >
                    <f:selectItem itemValue="MASCULINO" itemLabel="Masculino"/>
                    <f:selectItem itemValue="FEMININO" itemLabel="Feminino"/>
                </h:selectOneMenu>

                <h:commandButton value="Salvar" action="#{pessoaBean.salvar()}"/>
            </h:panelGrid>
        </h:form>

        <p:dataTable var="car" value="#{pessoaBean.listaTodas()}">  
            <p:column headerText="Identificador">  
                <h:outputText value="#{car.id}" />  
            </p:column>  

            <p:column headerText="Nome">  
                <h:outputText value="#{car.nome}" />  
            </p:column>  

            <p:column headerText="Data Nascimento">  
                <h:outputText value="#{car.dtNascimento}" />  
            </p:column>      
            <p:column headerText="Editar">  
                <h:button value="Editar" />  
            </p:column>  
        </p:dataTable> 
    </h:body>
</html>

